from grandalf.graphs import Graph, Vertex, Edge
from grandalf.layouts import SugiyamaLayout

# 创建图结构
v1 = Vertex("Node1")
v2 = Vertex("Node2")
e = Edge(v1, v2)
g = Graph([v1, v2], [e])

# 应用布局算法
layout = SugiyamaLayout(g)
layout.init_all()  # 初始化布局
layout.draw()      # 计算节点位置
